package com.youhong.teethcare.customviews;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.v4.widget.ImageViewCompat;
import android.util.AttributeSet;
import android.view.DragEvent;
import android.widget.ImageView;

/**
 * Created by Administrator on 2018/5/16 0016.
 */

public class ImageViewColorCard extends android.support.v7.widget.AppCompatImageView {


    public ImageViewColorCard(Context context) {
        super(context);
    }

    public ImageViewColorCard(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ImageViewColorCard(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public RectF rectf1, rectf2, rectf3, rectf4, rectf5, rectf6;
    float cell_width = 0f;

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        cell_width = w / 6;
        rectf1 = new RectF(0, 0, cell_width, 10);
        rectf2 = new RectF(cell_width + 1, 0, cell_width * 2, 10);
        rectf3 = new RectF(cell_width * 2 + 1, 0, cell_width * 3, 10);
        rectf4 = new RectF(cell_width * 3 + 1, 0, cell_width * 4, 10);
        rectf5 = new RectF(cell_width * 4 + 1, 0, cell_width * 5, 10);
        rectf6 = new RectF(cell_width * 5 + 1, 0, cell_width * 6, 10);

    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
    /*    Paint paint = new Paint();
        paint.setColor(Color.RED);
        paint.setStrokeWidth(20f);
        paint.setAntiAlias(true);*/
  /*      canvas.drawRect(rectf1,paint);
        canvas.drawRect(rectf2,paint);
        canvas.drawRect(rectf3,paint);
        canvas.drawRect(rectf4,paint);
        canvas.drawRect(rectf5,paint);
        canvas.drawRect(rectf6,paint);*/
    }
}
